From: Jeroen De Dauw Date: Tue, 20 Mar 2012 22:48:28 +0000 (+0000) Subject: added some tests using the intervals param X-Git-Tag: 1.31.0-rc.0~24170 X-Git-Url: http://git.cyclocoop.org/%22.%24match%5B1%5D.%22?a=commitdiff_plain;h=d42c2f4d7a689cbab0b90e30f6d2a96d8e32e96e;p=lhc%2Fweb%2Fwiklou.git added some tests using the intervals param --- diff --git a/tests/phpunit/languages/LanguageTest.php b/tests/phpunit/languages/LanguageTest.php index e355a383cb..ff3d92e9e7 100644 --- a/tests/phpunit/languages/LanguageTest.php +++ b/tests/phpunit/languages/LanguageTest.php @@ -658,10 +658,10 @@ class LanguageTest extends MediaWikiTestCase { /** * @dataProvider provideFormatDuration */ - function testFormatDuration( $duration, $expected ) { + function testFormatDuration( $duration, $expected, $intervals = array() ) { $this->assertEquals( $expected, - $this->lang->formatDuration( $duration ), + $this->lang->formatDuration( $duration, $intervals ), "formatDuration('$duration'): $expected" ); } @@ -752,6 +752,41 @@ class LanguageTest extends MediaWikiTestCase { 42 * 1000 * 31557600 + 42, '42 millennia and 42 seconds' ), + array( + 60, + '60 seconds', + array( 'seconds' ), + ), + array( + 61, + '61 seconds', + array( 'seconds' ), + ), + array( + 1, + '1 second', + array( 'seconds' ), + ), + array( + 31557600 + 2 * 86400 + 9000, + '1 year, 2 days and 150 minutes', + array( 'years', 'days', 'minutes' ), + ), + array( + 42, + '0 days', + array( 'years', 'days' ), + ), + array( + 31557600 + 2 * 86400 + 9000, + '1 year, 2 days and 150 minutes', + array( 'minutes', 'days', 'years' ), + ), + array( + 42, + '0 days', + array( 'days', 'years' ), + ), ); } }